<?php

class IndexController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        if(!Zend_Auth::getInstance()->hasIdentity()) {
            return $this->_redirect('/administracion/login');
        } else {
            return $this->_redirect('/circulacion/index');
        }
    }

    public function headerAction() {
        $this->_helper->layout->disableLayout();
        
        if ($this->_request->getParam('search') != '') {
            $search = trim($this->_request->getParam('search'));
        } elseif ($this->_request->getParam('q') != '') {
            $search = trim($this->_request->getParam('q'));
        } else {
            $search = '';
        }
        $this->view->search = $search;
        
        //TODO: jebuz -> implementar Model_Index()
        //$index = new Model_Index();
        //$this->view->indexListado = $index->getIndexListado();
    }
    
    public function navbarAction() {
        $this->_helper->layout->disableLayout();
        $tab = $this->_request->getParam('tab');
        
        $this->view->tab = $tab;
    }
    
    public function navbar2Action() {
        $this->_helper->layout->disableLayout();
        $tab2 = $this->_request->getParam('tab2');
        
        $this->view->tab2 = $tab2;
    }
    
    public function navbar2circulacionAction() {
        $this->_helper->layout->disableLayout();
        $tab2 = $this->_request->getParam('tab2');
        
        $this->view->tab2 = $tab2;
    }
    
}

